@import '../abstracts/variables';

.mud-toggle-group {
  display: grid;
  overflow: hidden;
  box-sizing: border-box;
  border-radius: var(--mud-default-borderradius);

  & > .mud-toggle-item {
    box-shadow: none;
    border-width: inherit;
    border-color: inherit;
    border-radius: 0;
  }
}

.mud-toggle-group-outlined {
  border-width: 1px;
  border-color: rgb(from var(--mud-palette-text-primary) r g b / var(--mud-palette-border-opacity));

  @each $color in $mud-palette-colors {
    &.mud-toggle-group-#{$color} {
      border-color: rgb(from var(--mud-palette-#{$color}) r g b / var(--mud-palette-border-opacity));
    }
  }

  &.mud-toggle-group-horizontal {
    &:not(.mud-toggle-group-rtl) {
      > .mud-toggle-item:not(:first-child), > :not(:first-child) .mud-toggle-item {
        &.mud-toggle-item-delimiter {
          border-left-style: solid !important;
        }

        margin-left: -1px;
      }
    }

    &.mud-toggle-group-rtl {
      > .mud-toggle-item:not(:last-child), > :not(:last-child) .mud-toggle-item {
        &.mud-toggle-item-delimiter {
          border-left-style: solid !important;
        }

        margin-left: -1px;
      }
    }
  }

  &.mud-toggle-group-vertical {
    > .mud-toggle-item:not(:first-child), > :not(:first-child) .mud-toggle-item {
      &.mud-toggle-item-delimiter {
        border-top-style: solid !important;
      }

      margin-top: -1px;
    }
  }
}

.mud-toggle-item {
  padding: 6px;
  min-width: auto;
  border-style: none !important;
  display: flex;
  justify-content: center;

  & > .mud-button-label {
    min-height: 20px;
  }

  .mud-toggle-item-check-icon {
    margin: 0 6px;
    font-size: 20px;
  }
}

.mud-toggle-item-size-small {
  padding: 4px;

  .mud-toggle-item-check-icon {
    margin: 0 4px;
    font-size: 18px;
  }
}

.mud-toggle-item-size-large {
  padding: 8px;

  .mud-toggle-item-check-icon {
    margin: 0 8px;
    font-size: 22px;
  }
}

.mud-toggle-item-fixed > .mud-button-label:has(>.mud-toggle-item-check-icon) {
  display: grid;
  grid-template-columns: 1fr repeat(3, auto) 1fr;
}

.mud-toggle-item-check-icon {
  justify-self: start;
}

.mud-toggle-item-content {
  display: contents;
}
